;***************************************************************************
; unit:    raster      release 0.33                                        *
; licency:     GPL or LGPL                                                 *
; Copyright: (c) 1998-2025 Jaroslav Fojtik                                 *
;***************************************************************************

.486              ;Target processor.  Use instructions for Pentium class machines
.MODEL FLAT, C    ;Use the flat memory model. Use C calling conventions

.CODE             ;Indicates the start of a code segment.



;void InterlockedAdd64(uint64_t *Value, uint32_t ValueAdd)
	public  InterlockedAdd64
InterlockedAdd64 proc \
        Value: ptr byte, \
        ValueAdd:DWORD
        
        mov	edx, [Value]
	mov	eax, [ValueAdd]

	lock add [edx], eax
	add 	edx,4
	jnc	ExitProc
	lock inc DWORD ptr [edx]
ExitProc:
        ret                     ; _cdecl return        
        
InterlockedAdd64 endp



        end
